<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>01-jQuery对象进行方法扩展</title>
    <script src="../../js/jquery-3.3.1.min.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript">
        $.fn.extend({
            check: function () {
                this.prop("checked", true)
            },
            uncheck: function () {
                this.prop("checked", false)
            }
        });
        $(function () {


        })


        function uncheckFn() {
            $("input[type='checkbox']").uncheck();

        }

        function checkFn() {
            $("input[type='checkbox']").check();

        }
    </script>
</head>
<body>
<input id="btn-check" type="button" value="点击选中复选框" onclick="checkFn()">
<input id="btn-uncheck" type="button" value="点击取消复选框选中" onclick="uncheckFn()">
<br/>
<input type="checkbox" value="football">足球
<input type="checkbox" value="basketball">篮球
<input type="checkbox" value="volleyball">排球

</body>
</html>

